<%@ Page Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeFile="Mp3Competition.aspx.cs"
    Inherits="Templates_Mp3Competition" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHeader" runat="Server">
    <acms:FlashContentControlDisplay ID="flashHeader" ControlName="FlashHeader" WMode="Transparent"
        MaxWidth="800" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="Server">
    <acms:FlashContentControlDisplay ID="flashIntro" ControlName="FlashIntro" WMode="Transparent"
        MaxWidth="500" runat="server" />
    <acms:ImageContentControlDisplay ID="imageIntro" ControlName="ImageIntro" runat="server" />
    <asp:LoginView ID="viewEnter" runat="server">
        <LoggedInTemplate>
                    <asp:Panel ID="pnlUsersEntryButtons" CssClass="htmlArticle" runat="server">
                        <h3>Enter the competition:</h3> 
                        <asp:HyperLink ID="btnEntryCreate" CssClass="csClickToEnter" NavigateUrl='<%#string.Concat("~/CentreStageEntry.aspx?PostId=", PostId)%>' Text="CLICK HERE TO ENTER YOUR BAND" runat="server" />
                        <asp:LinkButton ID="btnEntryView" OnClick="btnEntryView_Click" Text="View your entry"
                            CausesValidation="false" runat="server" />
                        <asp:LinkButton ID="btnEntryEdit" OnClick="btnEntryEdit_Click" Text="Edit your entry"
                            CausesValidation="false" runat="server" />
                        <asp:LinkButton ID="btnEntryDelete" OnClick="btnEntryDelete_Click" OnClientClick="return confirm('Are you sure you want to remove your entry?');"
                            Text="Remove your entry" CausesValidation="false" runat="server" />
                    </asp:Panel>
                    <asp:Panel ID="pnlEnter" CssClass="htmlArticle" Visible="false" runat="server">
                        <asp:Panel ID="pnlFileError" EnableViewState="false" Visible="false" CssClass="error"
                            runat="server">
                            Invalid file. Only image files less that 3MB and mp3 files less than 6MB may be uploaded.
                        </asp:Panel>
                        <asp:DetailsView ID="dvEntry" CssClass="csEntryEditTbl" DataSourceID="dsUserUpload" DataKeyNames="Id,ConcurencyId"
                            runat="server" OnDataBound="dvEntry_DataBound" OnItemCommand="dvEntry_ItemCommand"
                            AutoGenerateRows="False" OnItemInserting="dvEntry_ItemInserting" OnItemInserted="dvEntry_ItemInserted"
                            OnItemUpdated="dvEntry_ItemUpdated">
                            <Fields>
                                <acms:TextBoxField HeaderText="Band Name" DataField="Title" MaxLength="0" Required="true"
                                    RequiredMessage="*" RequiredValidationGroup="enter" RequiredDisplay="Dynamic"
                                    Width="250" />
                                <asp:TemplateField HeaderText="Image">
                                    <InsertItemTemplate>
                                        <asp:FileUpload ID="image" runat="server" />
                                        <asp:RequiredFieldValidator ID="valImage" ControlToValidate="image" ErrorMessage="*"
                                            ValidationGroup="enter" Display="Dynamic" runat="server" />
                                    </InsertItemTemplate>
                                    <EditItemTemplate>
                                        <acms:AcmsImage ID="image" FileId='<%#Eval("FileId") %>' RenderWidth="100" RenderHeight="100"
                                            runat="server" />
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                <acms:TextAreaField HeaderText="Bio" DataField="Comment" MaxLength="0" Required="True"
                                    RequiredMessage="*" RequiredValidationGroup="enter" RequiredDisplay="Dynamic"
                                    Cols="30" Rows="10" />
                                <asp:TemplateField HeaderText="Track Title">
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="songTitle" Width="250" runat="server" />
                                        <asp:RequiredFieldValidator ID="valSongTitle" ControlToValidate="songTitle" ValidationGroup="enter"
                                            ErrorMessage="*" Display="Dynamic" runat="server" />
                                    </InsertItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="songTitle" Width="250" Text='<%# ((Acms.Bll.UserPostUpload)Container.DataItem).GetTextValue("TrackTitle") %>'
                                            runat="server" />
                                        <asp:RequiredFieldValidator ID="valSongTitle" ControlToValidate="songTitle" ValidationGroup="enter"
                                            ErrorMessage="*" Display="Dynamic" runat="server" />
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Track">
                                    <InsertItemTemplate>
                                        <asp:FileUpload ID="song" runat="server" />
                                        <asp:RequiredFieldValidator ID="valSong" ControlToValidate="song" ValidationGroup="enter"
                                            ErrorMessage="*" Display="Dynamic" runat="server" />
                                    </InsertItemTemplate>
                                    <EditItemTemplate>
                                        <%# (((Acms.Bll.UserPostUpload)Container.DataItem).GetFile("Track") != null ? ((Acms.Bll.UserPostUpload)Container.DataItem).GetFile("Track").Name : "") %>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <InsertItemTemplate>
                                        <asp:LinkButton ID="btnEnter" Text="Enter" ValidationGroup="enter" CommandName="Insert"
                                            CausesValidation="true" runat="server" />
                                        <asp:LinkButton ID="btnCancel" Text="Cancel" CommandName="Cancel" CausesValidation="false"
                                            runat="server" />
                                    </InsertItemTemplate>
                                    <EditItemTemplate>
                                        <asp:LinkButton ID="btnEnter" Text="Save" ValidationGroup="enter" CommandName="Update"
                                            CausesValidation="true" runat="server" />
                                        <asp:LinkButton ID="btnCancel" Text="Cancel" CommandName="Cancel" CausesValidation="false"
                                            runat="server" />
                                    </EditItemTemplate>
                                </asp:TemplateField>
                            </Fields>
                        </asp:DetailsView>
                    </asp:Panel>
        </LoggedInTemplate>
        <AnonymousTemplate>
            <asp:HyperLink ID="lnkLogin" CssClass="needToLogInComp" NavigateUrl='<%#string.Concat("~/Login.aspx?ReturnUrl=", CurrentUrl) %>'
                runat="server" />
        </AnonymousTemplate>
    </asp:LoginView>
    <asp:UpdatePanel ID="updateSelected" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlSuspended" CssClass="htmlArticleWide" Visible="false" runat="server">
                <div class="compImageSelected">
                    <asp:Image ID="imgSuspended" ImageUrl="~/img/suspended-image.gif" AlternateText="Suspended Entrant" runat="server" />
                </div>
            </asp:Panel>
            <asp:Panel ID="pnlSelected" CssClass="htmlArticleWide" Visible="false" runat="server" OnDataBinding="pnlSelected_DataBinding">
                <div class="csBandInfo">
                   
                   <asp:Label id="lblBandName" CssClass="csBandName" runat="server" /> - <asp:Label id="lblTrackName" CssClass="csTrackName" runat="server" /><br />
                    <span class="csBandBio">"<asp:Label id="lblBio" runat="server" />"</span>
                </div>
                <div style="padding-left:4px" class="cs1">
                    <acms:AcmsImage ID="imgBand" CssClass="cs2" style="float:right;" runat="server" RenderWidth="200" RenderHeight="200" />
                    <acms:FlashControl ID="selectedTrack" Width="238" Height="83" FlashFileUrl="~/flash/mp3player.swf" runat="server" /><br />
                    <asp:UpdatePanel ID="updateVote" UpdateMode="Conditional" runat="server">
                        <ContentTemplate>
                           <div class="csVoteContainer">
                                <asp:Label ID="lblVote" runat="server" /><br />
                                <asp:Button ID="btnVote" Text="Vote For This Band!" OnClick="btnVote_Click" runat="server" />
                                <asp:Label ID="lblTotalVotes" runat="server" />
                           </div>
                        </ContentTemplate>
                </asp:UpdatePanel>
                </div>
                
                <div style="text-align:center;">
                    <asp:LinkButton ID="btnReport" Text="Report this entry as unsuitable." runat="server" OnClick="btnReport_Click"/>
                    <asp:Label ID="lblReported" Text="This entrant has been reported as unsuitable." runat="server" />
                </div>
                <div style="clear: both">
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:LoginView ID="viewVote" runat="server">
        <LoggedInTemplate>
        </LoggedInTemplate>
        <AnonymousTemplate>
            <asp:HyperLink ID="lnkLogin" CssClass="needToLogInComp" NavigateUrl='<%#string.Concat("~/Login.aspx?ReturnUrl=", CurrentUrl) %>'
                runat="server" />
        </AnonymousTemplate>
    </asp:LoginView>
    <div class="htmlArticleWide">
        <div style="clear: both">
        </div>
        <h3>Current Entries - select a track</h3>
        <asp:UpdatePanel ID="updEntrants" UpdateMode="Conditional" ChildrenAsTriggers="false"
            runat="server">
            <ContentTemplate>
                <acms:AcmsDataList ID="dlEntrants" UseAjax="true" DataSourceID="dsEntrants" AllowPaging="true"
                    PageSize="9" runat="server" OnItemCommand="dlEntrants_ItemCommand" OnItemDataBound="dlEntrants_ItemDataBound">
                    <NoDataStyle CssClass="htmlArticle" />
                    <NoDataTemplate>
                        There are currently no entrants to this competition.
                    </NoDataTemplate>
                    <SeperatorStyle CssClass="CompImgItemEndRow" />
                    <SeperatorTemplate>
                    </SeperatorTemplate>
                    <FooterStyle CssClass="CompImgItemEndRow" />
                    <FooterTemplate>
                    </FooterTemplate>
                    <ItemStyle CssClass="CompImgItem" />
                    <ItemTemplate>
                        <span>
                            <asp:Image ID="imgSuspended" ImageUrl="~/img/suspended-thumbnail.gif" ToolTip="Suspended Image"
                                runat="server" />
                            <asp:ImageButton ID="imgReported" ImageUrl="~/img/reported-thumbnail.gif" TootlTip="This image has been reported as unsuitable"
                                CommandName="Show" CommandArgument='<%#Eval("Id")%>' runat="server" />
                            <acms:AcmsImageLinkButton ID="imgThumb" RenderHeight="130" RenderWidth="130" FileId='<%#Eval("FileId")%>'
                                ToolTip='<%#Eval("Title")%>' CommandName="Show" CommandArgument='<%#Eval("Id")%>'
                                runat="server" />
                        </span>
                    </ItemTemplate>
                </acms:AcmsDataList>
                </ContentTemplate>
                </asp:UpdatePanel>
      <acms:UserPostUploadDataSource ID="dsEntrants" OnSelectData="dsEntrants_SelectData"
            runat="server" />
    </div>
    <acms:UserPostUploadDataSource ID="dsUserUpload" runat="server" OnSelectData="dsUserUpload_SelectData"
        OnBeforeUpdating="dsUserUpload_BeforeUpdating" OnUpdatingData="dsUserUpload_UpdatingData"
        OnUpdateData="dsUserUpload_UpdateData" />
</asp:Content>
